//
//  ThreeViewController.m
//  UI_元旦豆瓣小集合
//
//  Created by dllo on 15/12/31.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "ThreeViewController.h"
#import "PB3TableViewCell.h"
#import "My3model.h"
@interface ThreeViewController ()<UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, retain) UITableView *tableview;
@property (nonatomic, retain) NSMutableArray *arr;
@property (nonatomic, retain) NSMutableArray *arrData;

@end

@implementation ThreeViewController
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }return self;
}
- (void)dealloc {
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"影院";
    self.tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    _tableview.delegate = self;
    _tableview.dataSource = self;
    [self.view addSubview:_tableview];
    [_tableview release];
    
    NSString *str = [[NSBundle mainBundle] pathForResource:@"cinema" ofType:@"plist"];
    self.arrData = [NSMutableArray arrayWithContentsOfFile:str];
    self.arr = [[NSMutableArray alloc] init];
    for (NSDictionary *dic in _arrData) {
        My3model *model = [My3model my3model];
        [model setValuesForKeysWithDictionary:dic];
        [_arr addObject:model];
       
    }
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 250;
}
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _arr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    PB3TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[PB3TableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
    }
    My3model *model = _arr[indexPath.row];
    cell.cinemaName.text = model.cinemaName;
    cell.cinemaName.font = [UIFont boldSystemFontOfSize:20];
    cell.address.text = model.address;
    
    cell.telephone.text = model.telephone;
    
    
    cell.img.image = [UIImage imageNamed:@"4.png"];
    

    return cell;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
